#pragma once

#include "Misc/EngineEditorMacros.h"
#include "Object/Object.h"
#include "Math/Color.h"
#include "Math/Vec2.h"
#include "MaterialGraphLinkViewModel.m.h"

class RMaterialGraphLinkModel;
class RMaterialGraphPinViewModel;
class RMaterialGraphViewModel;

RCLASS()
class RMaterialGraphLinkViewModel : public RObject
{
    ROBJECT

public:
    virtual void BindModel(
        TSharedObjectPtr<RMaterialGraphLinkModel> InModel
        ,TSharedObjectPtr<RMaterialGraphViewModel> InGraphViewModel
        );

    bool IsHidden() const;

    //get center X in graph  space
    //graph space origin is center of the graph widget(when graph offset is 0,0)
    float GetStartXInGraphSpace() const;
    float GetStartYInGraphSpace() const;

    float GetEndXInGraphSpace() const;
    float GetEndYInGraphSpace() const;

    SColor GetStartColor() const;
    SColor GetEndColor() const;

    static TVector<SVec2> CalculateLinkingPoints(
        const SVec2& StartPos
        ,const SVec2& EndPos
    );
protected:
    TSharedObjectPtr<RMaterialGraphLinkModel> BaseModel;

    TSharedObjectPtr<RMaterialGraphPinViewModel> StartPin;
    TSharedObjectPtr<RMaterialGraphPinViewModel> EndPin;

};